package com.rsa.controller;

import lombok.extern.slf4j.Slf4j;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yinxing
 * @date 2022-09-07
 */
@RestController
@Slf4j
public class RsaController {


    @Resource
    private StringEncryptor stringEncryptor;

    @RequestMapping("/rsa")
    public String test(String message){
        if (!"11".equals(message)){
            String decrypt = stringEncryptor.decrypt(message);
            log.info("===========decrypt:{}===============",decrypt);
        }
        String result = "结果";
        String encrypt = stringEncryptor.encrypt(result);
        return encrypt;
    }


}
